<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>创建对象</title>
    <script>
        // 1、利用对象字面量创建对象,里面的属性和方法采取键值对的方法,多个属性和方法用,隔开
        var obj = {
            uname: '李嘉台',
            age: 18,
            sex: '男',
            sayHello: function () {
                console.log('hi!');
            }
        }
        // 2、使用对象
        console.log(obj.uname);
        console.log(obj['age']);
        obj.sayHello();
    </script>
</head>

<body>

</body>

</html>